package com.newspublish.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.newspublish.system.entity.system.News;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface NewsMapper extends BaseMapper<News> {

    //审核新闻
    int auditNews(News news);

    //获取news对象数据 不返回内容字段内容 保护数据安全
    News selectByPrimaryKeyexcludeContent(News news);

    //点赞
    @Update("update news set view=view+1")
    void like(Long id);

    //根据作者获取新闻列表
    List<News> selectByAuthor(String author,String publishState);

    //根据分类查询新闻
    List<News> selectByCategory(String author,String publishState);

}
